VERSION 5.00
Object = "{76DA8CE9-E736-47FC-B43F-82650E2EFBAF}#1.0#0"; "oControls.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmSec_Module 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   0  'None
   Caption         =   "Modules Installed"
   ClientHeight    =   3765
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   7095
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   3765
   ScaleWidth      =   7095
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Tag             =   "Settings"
   Begin oControls.oTab tabMain 
      Height          =   2685
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   6240
      _ExtentX        =   11007
      _ExtentY        =   4736
      TabCount        =   2
      TabCaption(0)   =   "            MAIN            "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "frmContainer"
      TabCaption(1)   =   "            LIST            "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "oFrames2"
      TabStyle        =   1
      TabTheme        =   1
      ActiveTabBackStartColor=   16514555
      ActiveTabBackEndColor=   16514555
      InActiveTabBackStartColor=   16777215
      InActiveTabBackEndColor=   15397104
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   10198161
      DisabledTabBackColor=   -2147483633
      DisabledTabForeColor=   10526880
      XRadius         =   15
      YRadius         =   15
      Begin oControls.oFrames frmContainer 
         Height          =   2385
         Left            =   0
         Top             =   300
         Width           =   6240
         _ExtentX        =   11007
         _ExtentY        =   4207
         FrameColor      =   16640737
         BackColor       =   16640737
         FillColor       =   16777215
         RoundedCorner   =   0   'False
         Caption         =   "Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Picture         =   "frmSec_Module.frx":0000
         Begin oControls.oTextBox txtcModuleID 
            Height          =   285
            Left            =   120
            TabIndex        =   2
            Tag             =   "1"
            Top             =   570
            Width           =   3090
            _ExtentX        =   5239
            _ExtentY        =   503
            BackColor       =   14745599
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Module ID"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   1530
         End
         Begin oControls.oTextBox txtcType 
            Height          =   285
            Left            =   3330
            TabIndex        =   3
            Top             =   570
            Width           =   2715
            _ExtentX        =   4577
            _ExtentY        =   503
            BackColor       =   14745599
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Type"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   1155
         End
         Begin oControls.oTextBox txtcDesc 
            Height          =   285
            Left            =   120
            TabIndex        =   4
            Top             =   915
            Width           =   5925
            _ExtentX        =   10239
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Description"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   4365
         End
         Begin oControls.oTextBox txtcLink 
            Height          =   285
            Left            =   120
            TabIndex        =   5
            Top             =   1230
            Width           =   5910
            _ExtentX        =   10213
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Link"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   4350
         End
         Begin oControls.oTextBox txtnIcon 
            Height          =   285
            Left            =   135
            TabIndex        =   6
            Top             =   1875
            Width           =   2175
            _ExtentX        =   3625
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Icon"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   615
         End
         Begin oControls.oTextBox txtcParent 
            Height          =   285
            Left            =   135
            TabIndex        =   7
            Tag             =   "1"
            Top             =   1545
            Width           =   3360
            _ExtentX        =   5715
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextButton      =   -1  'True
            Label           =   "Parent"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   1515
         End
         Begin oControls.oTextBox txtcParentDesc 
            Height          =   285
            Left            =   3510
            TabIndex        =   8
            Tag             =   "."
            Top             =   1545
            Width           =   2520
            _ExtentX        =   4339
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Module ID"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   2460
         End
      End
      Begin oControls.oFrames oFrames2 
         Height          =   2385
         Left            =   -75000
         Tag             =   "."
         Top             =   300
         Width           =   6240
         _ExtentX        =   11007
         _ExtentY        =   4207
         FrameColor      =   16777215
         FillColor       =   16640737
         RoundedCorner   =   0   'False
         Caption         =   "List of Quotations"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Picture         =   "frmSec_Module.frx":0A12
         Begin MSDataGridLib.DataGrid dtgList 
            Height          =   1965
            Left            =   0
            TabIndex        =   1
            Tag             =   "."
            Top             =   420
            Width           =   6240
            _ExtentX        =   11007
            _ExtentY        =   3466
            _Version        =   393216
            AllowUpdate     =   0   'False
            BackColor       =   16777215
            HeadLines       =   1
            RowHeight       =   15
            FormatLocked    =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   2
            BeginProperty Column00 
               DataField       =   "cModuleID"
               Caption         =   "Module ID"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cDesc"
               Caption         =   "Description"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
               EndProperty
               BeginProperty Column01 
                  ColumnWidth     =   4199.811
               EndProperty
            EndProperty
         End
      End
   End
End
Attribute VB_Name = "frmSec_Module"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'----------------------------------------------------------------------------------------------------------------------------------
'Standard Programming Format----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------------------------------------------------

Dim cnHeader As New Connection
Dim rsHeader As New Recordset
Dim tmpObj As Object

Dim sBit() As Boolean
Dim vBookmark As Variant

Public mode As eMode

Private Sub DataOtherBind()
    Set dtgList.DataSource = rsHeader
End Sub

Public Sub TBNew()
    mode = AddEditNew
    
    If rsHeader.State <> 1 Then
        TranConnect cnHeader
        TranRecordset Mid$(Me.Name, 4, Len(Me.Name)), rsHeader, cnHeader, "1=0"
        
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        DataOtherBind
    Else
        vBookmark = rsHeader.Bookmark
    End If
    
    ControlObjects Me
    BitEnable sBit, Me, oMDI
    
    rsHeader.AddNew
    
    RSDisconnectCN rsHeader
    
End Sub

Public Sub TBEdit()
    mode = AddEditNew
    
    ControlObjects Me
    
    RSDisconnectCN rsHeader
    
    BitEnable sBit, Me, oMDI
End Sub

Public Sub TBDelete()
    On Error GoTo ErrHandler
    
    Dim sID As String
    
    RSConnectCN rsHeader, cnHeader
    
    sID = rsHeader!cTranNo
    
    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, ProjectVersion) = vbNo Then Exit Sub
    
    AuditLog Mid$(Me.Name, 4, Len(Me.Name)), Trim(txtcModuleID), "Deleted"
    rsHeader.Delete adAffectCurrent
    
    rsHeader.UpdateBatch adAffectAll
    
    TBPrevious
    mode = Normal
    
    If rsHeader.RecordCount = 0 Then
        ClearDataValue Me
    Else
        vBookmark = rsHeader.Bookmark
        DataUnbind Me
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        rsHeader.Bookmark = vBookmark
    End If
    
    BitEnable sBit, Me, oMDI

ErrHandler:
    If Err.Number = -2147217885 Then
        Resume Next
    ElseIf Err.Number = -2147217864 Or Err.Number = -2147217887 Then
        cn.Execute "DELETE " & Mid$(Me.Name, 4, Len(Me.Name)) & "_D WHERE cTranNo = '" & sID & "' AND cCompID = '" & sCompanyID & "'"
        Resume Next
    End If

End Sub

Public Sub TBSave()
    On Error GoTo ErrHandler
    Dim lNew As Boolean
    
    mode = Find
    If rsHeader.Status = adRecNew Then lNew = True
    If MandatoryOK(Me) = False Then Exit Sub
    
    RSConnectCN rsHeader, cnHeader

    cn.BeginTrans
    cnHeader.BeginTrans
    
    rsHeader.UpdateBatch adAffectAll
   
    cn.CommitTrans
    cnHeader.CommitTrans
    
    Set FrmName = Me
    mode = Normal
    ControlObjects Me
    
    AuditLog Mid$(Me.Name, 4, Len(Me.Name)), rsHeader!cModuleID, IIf(lNew, "Add Record", "Modify Record")
    MsgBox "Record/s successfully saved.", vbInformation, ProjectVersion
    
    BitEnable sBit, Me, oMDI
ErrHandler:
    If Err.Number = -2147168237 Then
        rsHeader.CancelBatch adAffectCurrent
        cnHeader.RollbackTrans
    ElseIf Err.Number <> 0 Then
        MsgBox Err.Description, vbCritical, ProjectVersion
    End If
End Sub

Public Sub TBUndo()
    mode = Normal
    
    If rsHeader.Status = adRecNew Then
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
    End If
        
    DataUnbind Me
    If rsHeader.RecordCount = 0 Then
        ClearDataValue Me
        rsHeader.Close
        mode = Find
    Else
        rsHeader.Bookmark = vBookmark
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        DataOtherBind
    End If
    
    ControlObjects Me
    BitEnable sBit, Me, oMDI
End Sub

Public Sub TBFind()
    Dim sCond As String
    
    If mode = Find Then
        mode = Normal
        
        sCond = GetSearchString(Me)
        TranConnect cnHeader
        TranRecordset Mid$(Me.Name, 4, Len(Me.Name)), rsHeader, cnHeader, sCond
        
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        DataOtherBind
        
        RSDisconnectCN rsHeader
               
    Else
        mode = Find
        rsHeader.Close
        DataUnbind Me
        ClearDataValue Me
    End If
    
    ControlObjects Me
    BitEnable sBit, Me, oMDI
End Sub

Public Sub TBPrint()
    PrintReceipt Mid$(Me.Name, 4, Len(Me.Name)), rsHeader!cTranNo
End Sub

Public Sub TBFirst()
    FirstRecord rsHeader
End Sub

Public Sub TBPrevious()
    PreviousRecord rsHeader
End Sub

Public Sub TBNext()
    NextRecord rsHeader
End Sub

Public Sub TBLast()
    LastRecord rsHeader
End Sub

Public Sub TBNewLine()
    
End Sub

Public Sub TBDeleteLine()

End Sub

Public Sub TBApprove()

End Sub

Public Sub TBReject()

End Sub

Public Sub TBUntag()

End Sub

Public Sub TBClose()
    On Error Resume Next
    Set FrmName = Nothing
    Unload Me
End Sub

Public Sub TBReload()
    Me.ZOrder
    Set FrmName = Me
    BitEnable sBit, Me, oMDI
End Sub

Private Sub Form_Click()
    TBReload
End Sub

Private Sub Form_Load()
    GetAccessLevel oMDI.tbMain, sUserRole, Me.Name, sBit()
    mode = Find
    
    txtcParent.SQLScript = GetValFrTable("cValue", "System_Settings", "cCode='PKModule'")
    txtcParent.ConnectionStrings = sConnString
    
    ApplyFrameTheme frmContainer, Me
    BitEnable sBit, Me, oMDI
End Sub

Private Sub txtcParent_Change()
    txtcParentDesc = GetValFrTable("cDesc", "Sec_Module", "cCode='" & txtcParent & "'")
End Sub

